import requests

from lxml import etree


session  = requests.session()

# session = session
hearders = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"}
session.get("https://www.163.com",headers=hearders)
url  = "https://www.163.com/dy/article/H784O0PI0552IAT6_pdya11y.html"
res = session.get(url=url,headers=hearders)
res.encoding = "utf-8"
html = res.text
et = etree.HTML(html)
list = et.xpath("//div[@class='post_body']/p") 
endString = ""
for i in list:
    text = i.xpath("text()")
    if len(text) > 0:
        endString += text[0]
    else:
       strong = i.xpath("./strong/text()")
       if len(text) > 0:
           endString += strong[0]
       

print("endString = ",endString)        
    